<?php

namespace plugin\ycMassage\app\model;

use think\facade\Db;

class MassageUserTechnicianStatistics extends Model
{
    public static function browseNumInc($saas_appid, $technician_id)
    {
        $MassageUserTechnicianStatistics = MassageUserTechnicianStatistics::where(['saas_appid' => $saas_appid, 'uid' => $technician_id])->whereDay('create_time')->find();
        if (!$MassageUserTechnicianStatistics) {
            $MassageUserTechnicianStatistics = new MassageUserTechnicianStatistics;
            $MassageUserTechnicianStatistics->uid = $technician_id;
            $MassageUserTechnicianStatistics->saas_appid = $saas_appid;
        }
        $MassageUserTechnicianStatistics->browse_num = Db::raw('browse_num+1');
        $MassageUserTechnicianStatistics->save();
    }
    public static function onAfterRead($model)
    {
        $model->order_price = (float)$model->order_price;
        $model->commission = (float)$model->commission;
    }
}
